package com.etc.wc.utils;

import java.io.IOException;
import java.util.Properties;

/**
 * 单列模式之：懒汉模式考虑了线程安全
 */
public class PropertyHolderLazy {

    private static Properties pro = null;

    private PropertyHolderLazy() { }

    public static Properties getProps() throws IOException {
        if (pro == null) {
            synchronized (PropertyHolderLazy.class) {
                if (pro == null) {
                    pro = new Properties();
                    pro.load(PropertyHolder.class.getClassLoader().getResourceAsStream("collect.properties"));
                }
            }
        }
        return pro;
    }
}
